<template>
  <div style="height: 523px;
    overflow: hidden;
    background: white;
    border: 1px solid white;
    border-radius: 12px;
    margin-top: 10px ">

    <div style="background-color: white; height: 20px; text-align: left; padding: 10px; margin-top: 15px;">
      <h4>当前等待审核的申请单总数：0例</h4>
    </div>
    <div style="background-color: #E9EEF3; height: 407px; margin: 10px; padding: 4px; border-radius: 7px;">
      <template>
        <el-table :data="tableData" style="width: 100% ">
          <el-table-column prop="chukudanid" label="申请单" width="320">
          </el-table-column>
          <el-table-column prop="reason" label="出库理由" width="197">
          </el-table-column>
          <el-table-column prop="timekc" label="登记时间" width="100">
          </el-table-column>
          <el-table-column prop="chukuzonjianshu" label="总件数" width="100">
          </el-table-column>
          <el-table-column prop="chukuxiaoji" label="总金额(元)" width="100">
          </el-table-column>
          <el-table-column label="复核" width="100">
           <template slot-scope="scope">
               <el-button size="mini" @click.native.prevent="ddd(scope.row)" round>复核</el-button>
          </template>
          </el-table-column>
        </el-table>
      </template>
      <div class="block" style="position: absolute; bottom: 45px; margin-left:250px ;">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="14"
          :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper"
          :total="400">
        </el-pagination>
      </div>
    </div>
    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-form-item label="库房编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="库房编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="责任人编号" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>



  <el-dialog style="position: absolute; top: -78px;" title="提示" :visible.sync="dialogVisiible" width="90%"
      :before-close="handleClose">

      <el-table :data="tableDataa" size="mini">
        <el-table-column property="chukudanid" label="申请单" width="250"></el-table-column>
        <el-table-column property="reason" label="出库理由" width="190"></el-table-column>
        <el-table-column property="timekc" label="登记时间" width="160"></el-table-column>
        <el-table-column property="chukuzonjianshu" label="件数" width="160"></el-table-column>
        <el-table-column property="chukuxiaoji" label="金额(元)" width="160"></el-table-column>
      </el-table>
      <div class="block" style="margin-top: 14px;">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100"
          layout="total, sizes, prev, pager, next, jumper" :total="400">
        </el-pagination>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisiible = false">取 消</el-button>
        <el-button type="primary" @click="rukuupd">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: 'repinitsh',
    data() {
      return {
        tableData: [{
					repjingid:'',
					reason:'',
					timekc:''
				}],
				tableDataa:[],
        dialogTableVisible: false,
        dialogFormVisible: false,
				dialogVisiible:false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px'
      }
    },
    methods: {
      tableRowClassName({
        row,
        rowIndex
      }) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
			ddd(row){
				this.dialogVisiible=true;
				var demo=new URLSearchParams()
				demo.append("chukudanid",row.chukudanid)
				this.$http.post("selchukushRepwltddateis",demo)
				.then((res) => {
							if(res.data){
								 this.tableDataa=res.data;
																	 	this.tableDataa.forEach(item=>{

																	 	if(item.cpleixing==1){

																	 		item.cpleixing="商品";

																	 	}else if(item.cpleixing==2){

																	 			item.cpleixing="物料";

																	 	}else if(item.cpleixing==3){

																	 			item.cpleixing="委托部件";

																	 	}else if(item.cpleixing==4){
																	 		item.cpleixing="外购商品";

																	 		}else if(item.cpleixing==5){
																	 		item.cpleixing="委托产品";

																	 		}else if(item.cpleixing==6){
																	 		item.cpleixing="服务型产品";

																	 		}
																			})
							}
						})
						.catch((err) => { //请求失败
					console.log(err);
				});
			},
			rukuupd(){
				this.tableDataa.forEach((item)=>{
					var demo =new URLSearchParams()
					demo.append("chukuid",item.chukudanid)
					demo.append("ReviewSign",'已审核')
					this.$http.post("updidshRepwltddateiss",demo)
					.then((res) => {

							this.dialogVisiible = false;
							console.log(res);
						})
					.catch((err) => { //请求失败
						console.log(err);
					});

				})

			}
    },
		mounted(){
			this.$http.post("selchukuwshRepadmin")
				.then((res) => {
						if(res.data){
							 this.tableData=res.data;
																 	this.tableData.forEach(item=>{

																 	if(item.cpleixing==1){

																 		item.cpleixing="商品";

																 	}else if(item.cpleixing==2){

																 			item.cpleixing="物料";

																 	}else if(item.cpleixing==3){

																 			item.cpleixing="委托部件";

																 	}else if(item.cpleixing==4){
																 		item.cpleixing="外购商品";

																 		}else if(item.cpleixing==5){
																 		item.cpleixing="委托产品";

																 		}else if(item.cpleixing==6){
																 		item.cpleixing="服务型产品";

																 		}
																		})
						}
					})
					.catch((err) => { //请求失败
				console.log(err);
			});

		}
  }
</script>

<style scoped="scoped">
  * {
    padding: 0px;
    margin: 0px;
  }

  .el-breadcrumb__inner {
    color: black;

  }

  .el-input__inner {

    height: 25px;

  }

  .el-input__prefix,
  .el-input__suffix {
    position: absolute;
    top: 7px;
    -webkit-transition: all .3s;
    height: 100%;
    color: #C0C4CC;
    text-align: center;
  }

  .el-table td {
    padding: 10px 0;
  }
</style>
